package Task17;

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // while (scanner.hasNext()) {
        String string = scanner.nextLine();
        string = string.toLowerCase();
        String c = scanner.nextLine();
        c = c.toLowerCase();
        char ch = c.charAt(0);
        int count = 0;
        for (int i = 0; i < string.length(); i++) {
            if (string.charAt(i) == ch) {
                count++;
            }
        }
        System.out.println(count);
    }
    // }
}
